package br.com.dufs.mvc.controller;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

@Controller
@Scope("session")
public class MyBeanTab {

	private int currentTab = 1;

	public int getCurrentTab() {
	    return currentTab;
	}

	public void setCurrentTab(int currentTab) {
	    this.currentTab = currentTab;
	}

	public void onTabChange(org.primefaces.event.TabChangeEvent event) {
	    String id = event.getTab().getId();
	    if (id.equals("tab1")) {
	        this.setCurrentTab(1);
	    } else if (id.equals("tab2")) {
	        this.setCurrentTab(2);
	    } else if (id.equals("tab3")) {
	        this.setCurrentTab(3);
	    }
	}
	
}
